Agent functions never complete when using the python SDK inside Google Cloud functions. #477

Open
opened 2026-02-16 00:17:57 -05:00 by yindo · 0 comments
Owner

Originally created by @Antigaprime on GitHub (May 16, 2025).

Describe the bug
Methods for creating, deleting, fetching, etc, agents for use with LlamaExtract never complete when working with the python SDK in Google Cloud functions.

Client:

  • Python SDK Library
    • Python 3.13 (Ubuntu 22)

Additional context
Any operations that involve agents never complete. Running the exact same code locally works fine.

Sample code:

requirements.py
functions-framework==3.*
llama-cloud-services==0.6.22
main.py
import functions_framework
from llama_cloud_services import LlamaExtract


extractor = LlamaExtract(
    verbose=True,
)


def get_or_create_agent(name: str, schema: dict):
    try:
        agent = extractor.create_agent(name=name, data_schema=schema)
    except Exception as e:
        print(f"Error creating agent (might already exist): {e}")
        agent = extractor.get_agent(name=name)
        agent.data_schema = schema
    return agent


@functions_framework.http
def main(request):
    """HTTP Cloud Function.
    Args:
        request (flask.Request): The request object.
        <https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>
    Returns:
        The response text, or any set of values that can be turned into a
        Response object using `make_response`
        <https://flask.palletsprojects.com/en/1.1.x/api/#flask.make_response>.
    """
    schema = {
        "properties": {
            "intangible_assets": {
                "title": "Intangible Assets",
                "type": "number"
            },
            "revenue": {
                "title": "Revenue",
                "type": "number"
            },
            "current_liabilities": {
                "title": "Current Liabilities",
                "type": "number"
            },
            "total_liabilities": {
                "title": "Total Liabilities",
                "type": "number"
            }
        },
        "required": [
            "intangible_assets",
            "revenue",
            "current_liabilities",
            "total_liabilities"
        ],
        "title": "Response",
        "type": "object"
    }

    agent = get_or_create_agent("data-extractor", schema)
    print(agent)

    return {
        "msg": "ok"
    }
Originally created by @Antigaprime on GitHub (May 16, 2025). **Describe the bug** Methods for creating, deleting, fetching, etc, agents for use with LlamaExtract never complete when working with the python SDK in Google Cloud functions. **Client:** - Python SDK Library - `Python 3.13 (Ubuntu 22)` **Additional context** Any operations that involve agents never complete. Running the exact same code locally works fine. Sample code: ##### requirements.py ``` functions-framework==3.* llama-cloud-services==0.6.22 ``` ##### main.py ``` import functions_framework from llama_cloud_services import LlamaExtract extractor = LlamaExtract( verbose=True, ) def get_or_create_agent(name: str, schema: dict): try: agent = extractor.create_agent(name=name, data_schema=schema) except Exception as e: print(f"Error creating agent (might already exist): {e}") agent = extractor.get_agent(name=name) agent.data_schema = schema return agent @functions_framework.http def main(request): """HTTP Cloud Function. Args: request (flask.Request): The request object. <https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data> Returns: The response text, or any set of values that can be turned into a Response object using `make_response` <https://flask.palletsprojects.com/en/1.1.x/api/#flask.make_response>. """ schema = { "properties": { "intangible_assets": { "title": "Intangible Assets", "type": "number" }, "revenue": { "title": "Revenue", "type": "number" }, "current_liabilities": { "title": "Current Liabilities", "type": "number" }, "total_liabilities": { "title": "Total Liabilities", "type": "number" } }, "required": [ "intangible_assets", "revenue", "current_liabilities", "total_liabilities" ], "title": "Response", "type": "object" } agent = get_or_create_agent("data-extractor", schema) print(agent) return { "msg": "ok" } ```
yindo added the bug label 2026-02-16 00:17:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#477