Skip to content

Commit 519f429

Browse files
OnkarVO7TechyMTabhishekagrawal-atlanjunaidrahimAtMrun
authored
develop -> main (#273)
* refactor: enhance logger adapter tests with improved context handling and mock setup * refactor: update logger adapter test to use 'request_id' instead of 'extra' key * APP - 5069 : Added pyright pre-commit checks to application-sdk * Used pyright version 1.1.393 which is the latest one. * cleanup of stale dependencies in application-sdk - Removed alembic, fastapi-sqlalchemy, aiofiles, pygwalker from the pyproject.toml * Added a new-line at EOF for .pre-commit-config.yaml * APP-5418 : trivy github action should add comment to the PR and block the PR merge (#187) * APP-5418 : trivy github action should add comment to the PR and block the PR merge - Modified the flow so that trivy github action adds comments to the PR, block merging of that PR and uploads the scan details to Github Security tab too. * Updated aquasecurity/[email protected] to aquasecurity/[email protected] * APP-4989 : Rename `dapr_router` (#188) - dapr router is renamed to pubsub_router since it only handled subscription to events via dapr. * Removed otel-deps, numpy and pyyaml * update poetry.lock file * feat: enforce conventional commits Signed-off-by: Junaid Rahim <[email protected]> * Moved scale_data_generator to tests * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: update guide Signed-off-by: Junaid Rahim <[email protected]> * Made pyarrow an optional dependency, removed pydata-sphinx-theme, pylint and myst-parser * Added back myst-parser as it was being used by "Build Docs and Push to Kryptonite / generate-docs" * Added back pydata-sphinx-theme * added back pylint * Updated pyproject.toml wrt PR comments. * made numpy an optional test dependency. * refactor: remove redundant logging from SQL query fetch method * refactor: update logger format string for improved clarity * APP-5362 : feat: integrate uvloop for improved asyncio performance (#179) * feat: integrate uvloop for improved asyncio performance * feat: add uvloop integration for improved asyncio performance across the application * refactor: remove uvloop integration from various files * test: add unit tests for event loop implementations and performance comparison * refactor: clean up whitespace and formatting in event loop tests * test: simplify event loop tests by removing unnecessary assertions and imports * refactor: add whitespace for improved readability in decorators module * refactor: remove obsolete event loop tests and related imports * APP-5369 feat: Add ENVs support for Dapr Components (#186) * feat: Add ENVs support for Dapr Components * fix: Pre-Commit Check * APP-5081 : fixed healthchecks (#182) * update: Adding configuration for max concurrent activities * fix: precommit * fix: unit tests * fix: Added health timeouts and health checks for transform batch * fix: Code refactoring * refactor: enhance logger test messages with formatted workflow and activity context * refactor: simplify expected message in logger tests by removing context details * refactor: update expected logger messages to include detailed workflow and activity context * refactor: replace logging with loguru in logger adaptors and directory parser * refactor: remove outdated logger tests and fixtures for AtlanLoggerAdapter * test: add unit tests for AtlanLoggerAdapter and logger functions * Updating pyproject.toml * refactor: update expected logger messages to use dynamic workflow and activity context variables * refactor: update logger adapter test to use run_id instead of workflow_run_id * refactor: update test command to use quiet mode and short traceback format * refactor: improve error logging in AtlasTransformer for better context * refactor: comment out cached venv loading in GitHub Actions workflow * refactor: comment out condition for cached dependencies installation in GitHub Actions workflow * refactor: update logging format in FastAPIApplication for improved readability * refactor: update logging format in SQLClient for improved string interpolation * refactor: improve error logging format in SQLClient and AtlasTransformer for better clarity * refactor: update logging format in SQLClient for improved string interpolation * refactor: enhance logging context handling in AtlanLoggerAdapter for improved robustness * refactor: streamline workflow and activity context handling in AtlanLoggerAdapter for improved clarity * APP-5495 stale prs github action does not seem to be working - Made the workflow callable * Modified the cron to run daily instead of weekly * refactor: simplify expected message formatting in logger adapter tests for improved readability * refactor: add print statements in logger adapter tests for debugging purposes * feat(docs): add driver class Signed-off-by: Junaid Rahim <[email protected]> * feat: added local server Signed-off-by: Junaid Rahim <[email protected]> * feat: added supported features matrix Signed-off-by: Junaid Rahim <[email protected]> * refactor: clean up error logging and improve message formatting in SQLClient and AtlanLoggerAdapter * refactor: enable loading of cached virtual environment in GitHub Actions workflow * refactor: update GitHub Actions workflow to improve test coverage reporting * No code changes made. * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * debug * debug * fix: adding skip in the right places * fix: Add Cloud specific metadata for Output Bindings * updated pyproject.toml * chore: update poetry.lock to remove unnecessary groups and markers * debug * debug * debug * debug * debug * made boto3-stubs as optional and as a module * fix: required * boto3-stubs and boto3 are part of the same module * Updated poetry.lock * chore: Update metadata payload * chore: Update metadata payload * feat: Allow apps to override heartbeat timeout * chore: Update metadata payload * Refactored pyproject.toml - Removed aiofiles - Made pyarrow an optional dependency - added pandas to dev dependency - Removed starlette-context - removed pyyaml - renamed boto3 module to iam_auth - removed pandas and pyarrorw from test dependency - Removed pygwalker and numpy * Updated pyproject.toml by adding comments * fixed pre-commit checks * Updated pyproject.toml - Moved boto3-stubs to dev-dependency * Updated comments on pyproject.toml * fix: Pre-Commit Check * feat: agents * refactor: APP-4889 Refactor `ChunkedObjectStoreWriterInterface` to the Inputs / Outputs interface * APP-5484 e2e test framework * fix poetry * handle exceptions * fix: APP-5585 Bug: Incorrect credentials inaccurate error message - Preflight check hander - Added error handling for sql_client.load() method - modified the metadata extraction activity to create and store handler before awaiting for the sql_client * update custom test * fix: APP-5438: Description/remarks causing diff (KIWI) (#203) * refactor: remove unnecessary JSON serialization in process_text function * refactor: improve test output format in CI workflow * fix: remove unnecessary JSON parsing in schema and table tests * refactor: update test descriptions and improve coverage command * fix: correct command syntax in CI workflow for running tests with coverage * refactor: enhance text processing by removing HTML tags and normalizing whitespace * refactor: streamline text processing by combining HTML tag removal and whitespace normalization * converted exception handling into seperate function and used that in to handle exceptions. * improved code readability * APP-5037 Add unit tests for tables and views (#209) - Added unit tests to validate this scenario : ”In the current application-sdk, even if temp_table_regex is None, we still add a regex condition in our SQL statements - NOT TABLE_NAME RLIKE '^$'. With this change, if temp_table_regex is empty, then this condition would not be added.” * Changes to ParquetInputs and ParquetOutputs - Added decorator based tests for both the input and the output classes - Added a parquet Input class - Used native daft and pandas methods to implement the Input and the Output classes. * renamed decorator from transform_pandas to transform * Made the tests functional for testing parquet with pandas and daft both * Instead of using string matches, used SQLAlchemy specific exceptions * Input will read from objectStore and Output will push to objectstore * feat(docs): APP-5321 mount doc server with app * feat(docs): mount doc server with app * chore: cleanup * chore: APP-5393 create different action for conventional commits Signed-off-by: Junaid Rahim <[email protected]> * Pathed read_file and upload_file methods. * Removed sqlalchemy specific error handling alltogether * Made engine creation and connection under single try / Except * APP-5482 [Unit Tests] Improve coverage and maintain coverage report (#208) * Improvement : APP-5482 [Unit Tests] Improve coverage and maintain coverage report Added command for the coverage to omit tests folder Added command for the unit test step to fail if the coverage falls under 60 * APP-5037 Add unit tests for tables and views - Added a test to test_workflow.py which would test the following scenario : "In the current application-sdk, even if temp_table_regex is None, we still add a regex condition in our SQL statements - NOT TABLE_NAME RLIKE '^$'. With this change, if temp_table_regex is empty, then this condition would not be added." * Revert "APP-5037 Add unit tests for tables and views" This reverts commit 4392fda. * feat: APP-5393 add semantic releases (#211) * feat: add semantic releases * ci: update secret for releases (#216) Signed-off-by: Junaid Rahim <[email protected]> * ci: update secret for releases (#216) (#217) Signed-off-by: Junaid Rahim <[email protected]> * ci: APP-5393 correct duplicate env (#218) * add gh action to trigger workflow from sdk * fix poetry conflicts * check api resp * App-5256 Transformation time improvements (#193) * single assignment for columns * single assignment for all types * fix: transformed data didnt have attributes * fix(docgen): make mkdocs dep optional Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * update deps * add mkdocs temporarily * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * re-added scale data generator module in pyproject.toml * ci: APP-5393 correct release commit user (#225) * ci: correct release commit user Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> --------- Signed-off-by: Junaid Rahim <[email protected]> * fix poetry file * rmv mkdocs * fix: custom attributes * fix: tests * ci: APP-5393 correct commit command (#226) * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * ci: correct commit command Signed-off-by: Junaid Rahim <[email protected]> --------- Signed-off-by: Junaid Rahim <[email protected]> * ci: APP-5661 Added Resource Attributes in the otel logger (#219) * added resoruce attributes via the code * refactor: improve formatting and readability in logger_adaptors.py * refactor: enhance resource attribute parsing in logger_adaptors.py * refactor: improve attribute parsing logic in logger_adaptors.py * refactor: add error handling to resource attribute parsing in logger_adaptors.py * fix: correct typo in method name for resource attribute parsing in logger_adaptors.py * fix: ruff errors * feat: interface for agents * fix: req, langgraph agent, loggers * fix: rename agent files * fix: lock dependencies * fix: pre-commit formatting * fix: langgraph agent * fix: lock dependencies * docs: added example on how to define and use langgraph agent * feat: created the langgraphagent related workflow, activities, 2. some changes for temporal.py to pass in workflow args properly * chore: examples updated * fix: remove poetry.lock * feat: tests are added for the agentic changes made to sdk * fix: gh actions to install the deps * fix: circular import problem * fix: deps install if deps are added in pyproject.toml * fix: deps duplication * chore(release): bump version (#231) * ci: APP-5393 correct commit command (#229) Signed-off-by: Junaid Rahim <[email protected]> * chore(release): bump version (#232) * chore(release): bump version (#233) * chore(release): bump version (#234) * use dispatch gh * fix poetry 3 * ci: APP-5393 handle edge case for cascading releases (#236) * ci: handle edge case for cascading releases Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> --------- Signed-off-by: Junaid Rahim <[email protected]> * chore(release): bump version (#238) * test2 * test3" " * chore: poetry lock * chore: lock updates * check commit hash * checkout repo * test6 * echo commit hashes * add event after for commit hash * rmv whitespace * update the branch to develop * chore(release): bump version (#240) * fix: Trivy Action to ignore the unfixed vulnerabilities (#239) * chore(release): bump version (#242) * fix: APP-5598 Health check timeout 1m assets (#243) * Removing max transform concurrency * fix: pin dapr CLI to 1.14.1 --------- Co-authored-by: Nishchith Shetty <[email protected]> * chore(release): bump version (#244) * feat: fastapi app added for the agent * fix: lock deps * Configurable timeouts (#245) * configurable timeouts * default_schedule_to_start_timeout - increase to 6 hours * chore(release): bump version (#246) * APP-5482: [Unit Tests] Improve coverage and maintain coverage report (#224) - add coverage reports to s3 bucket. * chore(release): bump version (#247) * feat: moved everything realted to agent workflow into the code sdk * chore: added examples, and readme to init the fastapiagentapp * fix: poetry lock * fix: failing tests, types * fix: agent type issues, validation, improve error message, llm import * fix: prefix / added in the fastapiagentapp * fix: langgraph related imports * chore: update readme for the agents * fix: error msgs, dependencies, readme * fix: api endpoint, readme example * chore: APP-5485 Optimise and add workflow timeout to e2e test framework github action (#248) * APP-5485 add workflow timeout to e2e tests * Modified echo * chore: fetch correct commit sha * chore(release): bump version (#249) * bump atlan-python to v5.0.1 (#252) * chore(release): bump version (#253) * fix: APP-5439 add exclude_unset to true (#254) * bump atlan-python to v5.0.1 * update: add exclude_unset to true * chore(release): bump version (#255) * fix: Clean up logger messages and remove color formatting (#256) * removed addition of colors from message * fix: remove HTML tags from log messages and clean up logger context * chore(release): bump version (#257) * chore(release): bump version (#260) * fix: lock deps * chore(release): bump version (#264) * feat(docgen): APP-5643 add sql parsing (#237) Signed-off-by: Junaid Rahim <[email protected]> * chore(release): bump version (#267) * fix: Make e2e test base branch dynamic (#266) * chore(release): bump version (#268) * docs: added decorator doc strings and examples (#265) * chore(release): bump version (#269) * docs: APP-5752 setup mkdocs with pydoctor (#263) * chore: cleanup * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup --------- Signed-off-by: Junaid Rahim <[email protected]> * chore(release): bump version (#270) * fix(docs): APP-5272 correct docstrings for decorators (#271) * fix(docs): correct docstrings for decorators * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> * chore: cleanup Signed-off-by: Junaid Rahim <[email protected]> --------- Signed-off-by: Junaid Rahim <[email protected]> * chore(release): bump version (#272) * fix: heartbeat, timeout configurable * chore(release): bump version (#275) * fix: usage of workflow_config and workflow args (#276) * chore(release): bump version (#277) --------- Signed-off-by: Junaid Rahim <[email protected]> Co-authored-by: Mustafa <[email protected]> Co-authored-by: Mustafa <[email protected]> Co-authored-by: Abhishek Agrawal <[email protected]> Co-authored-by: Junaid Rahim <[email protected]> Co-authored-by: Mrunmayi Tripathi <[email protected]> Co-authored-by: Ujala Singh <[email protected]> Co-authored-by: SanilK2108 <[email protected]> Co-authored-by: ujala-singh <[email protected]> Co-authored-by: Hrushikesh Dokala <[email protected]> Co-authored-by: Nishchith Shetty <[email protected]> Co-authored-by: Atlan CI <[email protected]> Co-authored-by: Amit Prabhu <[email protected]>
1 parent e9e4a7d commit 519f429

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3355
-1084
lines changed

.github/workflows/checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ jobs:
3333
- name: Install dependencies
3434
run: |
3535
poetry config virtualenvs.in-project true
36-
poetry install --no-root --without dev,test --extras "workflows"
36+
poetry install --no-root --without dev,test --extras "workflows langgraph_agent"
3737
- uses: pre-commit/[email protected]

.github/workflows/docs.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
git config --global url."https://${{ secrets.ORG_PAT_GITHUB }}".insteadOf "ssh://git";
5151
poetry install --with "dev, test" --all-extras
5252
source .venv/bin/activate
53-
make sphinx_docs
53+
make apidocs
5454
pyreverse -o html application_sdk
5555
5656
- name: Setup AWS Credentials
@@ -62,14 +62,14 @@ jobs:
6262
- name: Upload Docs to Kryptonite Bucket
6363
if: ${{ github.event_name == 'push' }}
6464
run: |
65-
aws s3 sync ./docs/_build/html s3://kryptonite-store/application-sdk/${{ steps.get_branch.outputs.branch }} --delete
65+
aws s3 sync ./docs/site s3://kryptonite-store/application-sdk/${{ steps.get_branch.outputs.branch }} --delete
6666
aws s3 cp packages.html s3://kryptonite-store/application-sdk/${{ steps.get_branch.outputs.branch }}/packages.html
6767
aws s3 cp classes.html s3://kryptonite-store/application-sdk/${{ steps.get_branch.outputs.branch }}/classes.html
6868
6969
- name: Upload Docs to Kryptonite Bucket
7070
if: ${{ github.event_name == 'pull_request' }}
7171
run: |
72-
aws s3 sync ./docs/_build/html s3://kryptonite-store/application-sdk/${{ github.head_ref }} --delete
72+
aws s3 sync ./docs/site s3://kryptonite-store/application-sdk/${{ github.head_ref }} --delete
7373
aws s3 cp packages.html s3://kryptonite-store/application-sdk/${{ github.head_ref }}/packages.html
7474
aws s3 cp classes.html s3://kryptonite-store/application-sdk/${{ github.head_ref }}/classes.html
7575

.github/workflows/e2e-integration-tests.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@ jobs:
3434
echo "distinct_id=${{ github.sha }}" >> $GITHUB_ENV
3535
fi
3636
37+
if [ "${{ github.base_ref }}" ]; then
38+
echo "base_branch=refs/heads/${{ github.base_ref }}" >> $GITHUB_ENV
39+
else
40+
echo "base_branch=${{ github.ref }}" >> $GITHUB_ENV
41+
fi
42+
3743
- name: Trigger E2E Integrations Tests
3844
uses: codex-/return-dispatch@v2
3945
id: return_dispatch
4046
with:
4147
token: "${{ secrets.ORG_PAT_GITHUB }}"
42-
ref: "refs/heads/develop"
48+
ref: ${{ env.base_branch }}
4349
repo: ${{ matrix.repo_name }}
4450
owner: "atlanhq"
4551
workflow: "e2e-integration-test.yaml"

.github/workflows/tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ jobs:
7575
uses: actions/cache@v4
7676
with:
7777
path: .venv
78-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
78+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock', '**/pyproject.toml') }}
7979

8080
#----------------------------------------------
8181
# install dependencies if cache does not exist
8282
#----------------------------------------------
8383
- name: Install dependencies
8484
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
85-
run: poetry install --no-interaction --no-root --extras "iceberg workflows daft"
85+
run: poetry install --no-interaction --no-root --extras "iceberg workflows daft langgraph_agent"
8686

8787
- name: Run Unit and Integration Tests with Coverage
8888
run: |

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ venv.bak/
137137
.ropeproject
138138

139139
# mkdocs documentation
140-
/site
140+
docs/site
141141

142142
# mypy
143143
.mypy_cache/

Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ stop-all:
2828
@echo "All detached processes stopped."
2929

3030

31-
# Generate Sphinx documentation
32-
sphinx_docs:
33-
mkdir -p docs/reference
34-
sphinx-apidoc -o ./docs/reference ./application_sdk --tocfile index --module-first --separate --force
35-
cd docs && make html
36-
31+
# Generate documentation
32+
apidocs:
33+
cd docs && mkdocs build
34+
cd docs && pydoctor --html-output=site/api ../application_sdk --docformat=google
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
"""
2+
LangGraph activities interface.
3+
4+
This module provides the activities interface for LangGraph agent operations,
5+
including graph compilation and task execution.
6+
"""
7+
8+
import importlib
9+
from typing import Any, Callable, Dict, Optional, Union
10+
11+
from temporalio import activity
12+
13+
from application_sdk.activities import ActivitiesInterface
14+
from application_sdk.common.logger_adaptors import get_logger
15+
16+
logger = get_logger(__name__)
17+
18+
try:
19+
from langgraph.graph import StateGraph
20+
21+
from application_sdk.agents.langgraph_agent import LangGraphAgent
22+
23+
LANGGRAPH_AVAILABLE = True
24+
except ImportError:
25+
logger.warning("LangGraph is not installed, agent functionality will be disabled")
26+
LANGGRAPH_AVAILABLE = False
27+
StateGraph = Any # type: ignore
28+
LangGraphAgent = Any # type: ignore
29+
30+
# Registry to store graph builder functions
31+
_graph_builders: Dict[str, Callable[..., Union[StateGraph, Any]]] = {}
32+
33+
34+
def register_graph_builder(
35+
name: str, builder_func: Callable[..., Union[StateGraph, Any]]
36+
) -> None:
37+
"""Register a graph builder function.
38+
39+
Args:
40+
name: The name to register the builder under
41+
builder_func: A function that returns a StateGraph
42+
"""
43+
if not LANGGRAPH_AVAILABLE:
44+
logger.warning(
45+
"LangGraph is not installed, graph builder registration will be ignored"
46+
)
47+
return
48+
49+
_graph_builders[name] = builder_func
50+
51+
52+
def get_graph_builder(name: str) -> Optional[Callable[..., Union[StateGraph, Any]]]:
53+
"""Get a graph builder by name.
54+
55+
Args:
56+
name: The name of the builder to get
57+
58+
Returns:
59+
The builder function or None if not found
60+
"""
61+
if not LANGGRAPH_AVAILABLE:
62+
logger.warning("LangGraph is not installed, cannot get graph builder")
63+
return None
64+
65+
# Check if builder is directly in registry
66+
if name in _graph_builders:
67+
return _graph_builders[name]
68+
69+
# Try to import from module path (e.g. "my_module.my_builder")
70+
try:
71+
if "." in name:
72+
module_path, func_name = name.rsplit(".", 1)
73+
module = importlib.import_module(module_path)
74+
if hasattr(module, func_name):
75+
builder = getattr(module, func_name)
76+
# Cache for future use
77+
_graph_builders[name] = builder
78+
return builder
79+
except ImportError:
80+
logger.error(f"Could not import graph builder module: {name}")
81+
except Exception as e:
82+
logger.error(f"Error loading graph builder: {str(e)}")
83+
84+
return None
85+
86+
87+
class LangGraphActivities(ActivitiesInterface):
88+
"""Activities for LangGraph agent operations.
89+
90+
This class defines the activities that can be executed as part of
91+
LangGraph workflows, including graph compilation and task execution.
92+
"""
93+
94+
@activity.defn
95+
async def run_agent(self, activity_input: Dict[str, Any]) -> Dict[str, Any]:
96+
"""Runs the LangGraph agent with the given task.
97+
98+
Args:
99+
activity_input (Dict[str, Any]): Input for the activity,
100+
including user query, state, and graph_builder_name.
101+
102+
Returns:
103+
Dict[str, Any]: Result of the agent task execution.
104+
"""
105+
if not LANGGRAPH_AVAILABLE:
106+
return {
107+
"error": "LangGraph is not installed. Please install the package with 'pip install langgraph' or use the langgraph_agent extra."
108+
}
109+
110+
try:
111+
user_query = activity_input.get("user_query")
112+
if not user_query:
113+
return {"error": "Error: No user query provided."}
114+
115+
graph_builder_name = activity_input.get("graph_builder_name")
116+
if not graph_builder_name:
117+
return {"error": "Error: No graph builder name provided."}
118+
119+
# Get the graph builder function
120+
graph_builder = get_graph_builder(graph_builder_name)
121+
if not graph_builder:
122+
return {
123+
"error": f"Error: Graph builder '{graph_builder_name}' not found."
124+
}
125+
126+
# Build the StateGraph
127+
try:
128+
state_graph = graph_builder()
129+
except Exception as e:
130+
logger.error(f"Error building graph: {str(e)}")
131+
return {"error": f"Error building graph: {str(e)}"}
132+
133+
# Initialize the agent
134+
agent = LangGraphAgent(
135+
state_graph=state_graph,
136+
state=activity_input.get("state", {"messages": []}),
137+
)
138+
139+
# Compile and run the graph
140+
agent.compile_graph()
141+
response = agent.run(user_query)
142+
state = agent.state
143+
144+
return {
145+
"result": "Agent execution completed successfully",
146+
"response": response,
147+
"state": state,
148+
}
149+
except Exception as e:
150+
error_msg = f"Error running agent task: {str(e)}"
151+
logger.error(error_msg)
152+
return {"error": error_msg}

application_sdk/activities/common/utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ def auto_heartbeater(fn: F) -> F:
5151
F: The decorated activity function.
5252
5353
Note:
54-
* We have activities that can run for a long time, in case of a failure (say: worker crash)
54+
We have activities that can run for a long time, in case of a failure (say: worker crash).
55+
5556
Temporal will not retry the activity until the configured timeout is reached.
56-
* We add auto_heartbeater to activities to ensure an failure is detected earlier
57+
58+
We add auto_heartbeater to activities to ensure an failure is detected earlier
5759
and the activity is retried.
5860
5961
- https://temporal.io/blog/activity-timeouts
@@ -63,7 +65,7 @@ def auto_heartbeater(fn: F) -> F:
6365
>>> @activity.defn
6466
>>> @auto_heartbeater
6567
>>> async def my_activity():
66-
>>> pass
68+
... pass
6769
"""
6870

6971
@wraps(fn)

0 commit comments

Comments
 (0)