libraos-sdk 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- libraos_sdk-1.0.1/PKG-INFO +246 -0
- libraos_sdk-1.0.1/README.md +225 -0
- libraos_sdk-1.0.1/libraos/__init__.py +55 -0
- libraos_sdk-1.0.1/libraos/_generated/__init__.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/api/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/agents/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/agents/create_agent.py +177 -0
- libraos_sdk-1.0.1/libraos/_generated/api/agents/delete_agent.py +160 -0
- libraos_sdk-1.0.1/libraos/_generated/api/agents/get_agent.py +162 -0
- libraos_sdk-1.0.1/libraos/_generated/api/agents/get_agent_schema.py +144 -0
- libraos_sdk-1.0.1/libraos/_generated/api/agents/list_agents.py +192 -0
- libraos_sdk-1.0.1/libraos/_generated/api/agents/update_agent.py +188 -0
- libraos_sdk-1.0.1/libraos/_generated/api/deployment/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/deployment/get_deployment.py +162 -0
- libraos_sdk-1.0.1/libraos/_generated/api/documents/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/documents/delete_document.py +160 -0
- libraos_sdk-1.0.1/libraos/_generated/api/documents/list_documents.py +179 -0
- libraos_sdk-1.0.1/libraos/_generated/api/documents/upload_document.py +165 -0
- libraos_sdk-1.0.1/libraos/_generated/api/employees/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/employees/create_employee.py +166 -0
- libraos_sdk-1.0.1/libraos/_generated/api/employees/delete_employee.py +160 -0
- libraos_sdk-1.0.1/libraos/_generated/api/employees/export_employee_bundle.py +177 -0
- libraos_sdk-1.0.1/libraos/_generated/api/employees/get_employee.py +162 -0
- libraos_sdk-1.0.1/libraos/_generated/api/employees/list_employees.py +179 -0
- libraos_sdk-1.0.1/libraos/_generated/api/employees/update_employee.py +188 -0
- libraos_sdk-1.0.1/libraos/_generated/api/filesystem/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/filesystem/delete_file.py +118 -0
- libraos_sdk-1.0.1/libraos/_generated/api/filesystem/list_files.py +244 -0
- libraos_sdk-1.0.1/libraos/_generated/api/filesystem/read_file.py +185 -0
- libraos_sdk-1.0.1/libraos/_generated/api/filesystem/write_file.py +230 -0
- libraos_sdk-1.0.1/libraos/_generated/api/hooks/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/hooks/create_hook.py +191 -0
- libraos_sdk-1.0.1/libraos/_generated/api/hooks/delete_hook.py +163 -0
- libraos_sdk-1.0.1/libraos/_generated/api/hooks/get_hook.py +166 -0
- libraos_sdk-1.0.1/libraos/_generated/api/hooks/list_hooks.py +134 -0
- libraos_sdk-1.0.1/libraos/_generated/api/jobs/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/jobs/cancel_job.py +160 -0
- libraos_sdk-1.0.1/libraos/_generated/api/jobs/create_job.py +167 -0
- libraos_sdk-1.0.1/libraos/_generated/api/jobs/get_job.py +162 -0
- libraos_sdk-1.0.1/libraos/_generated/api/jobs/list_jobs.py +212 -0
- libraos_sdk-1.0.1/libraos/_generated/api/jobs/stream_job.py +329 -0
- libraos_sdk-1.0.1/libraos/_generated/api/knowledge/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/knowledge/ingest_knowledge.py +176 -0
- libraos_sdk-1.0.1/libraos/_generated/api/knowledge/list_knowledge_collections.py +134 -0
- libraos_sdk-1.0.1/libraos/_generated/api/knowledge/search_knowledge.py +176 -0
- libraos_sdk-1.0.1/libraos/_generated/api/messages/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/messages/create_message.py +210 -0
- libraos_sdk-1.0.1/libraos/_generated/api/messages/submit_custom_tool_result.py +202 -0
- libraos_sdk-1.0.1/libraos/_generated/api/personas/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/personas/get_persona_by_id.py +173 -0
- libraos_sdk-1.0.1/libraos/_generated/api/personas/list_personas.py +177 -0
- libraos_sdk-1.0.1/libraos/_generated/api/sessions/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/sessions/create_managed_session.py +187 -0
- libraos_sdk-1.0.1/libraos/_generated/api/sessions/get_managed_session.py +157 -0
- libraos_sdk-1.0.1/libraos/_generated/api/settings/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/settings/get_setting.py +159 -0
- libraos_sdk-1.0.1/libraos/_generated/api/settings/list_settings.py +134 -0
- libraos_sdk-1.0.1/libraos/_generated/api/settings/put_setting.py +185 -0
- libraos_sdk-1.0.1/libraos/_generated/api/users/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/_generated/api/users/create_user.py +167 -0
- libraos_sdk-1.0.1/libraos/_generated/api/users/delete_user.py +155 -0
- libraos_sdk-1.0.1/libraos/_generated/api/users/get_user.py +157 -0
- libraos_sdk-1.0.1/libraos/_generated/api/users/list_users.py +130 -0
- libraos_sdk-1.0.1/libraos/_generated/client.py +268 -0
- libraos_sdk-1.0.1/libraos/_generated/errors.py +16 -0
- libraos_sdk-1.0.1/libraos/_generated/models/__init__.py +257 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent.py +308 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_create.py +237 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_create_filesystem.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_create_guardrails.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_create_visibility.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_filesystem.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_guardrails.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_list.py +95 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_type.py +9 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_update.py +236 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_update_filesystem.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_update_guardrails.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_update_visibility.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/agent_visibility.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/bundle_import_result.py +91 -0
- libraos_sdk-1.0.1/libraos/_generated/models/bundle_manifest.py +110 -0
- libraos_sdk-1.0.1/libraos/_generated/models/bundle_manifest_schema_version.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/custom_tool.py +106 -0
- libraos_sdk-1.0.1/libraos/_generated/models/custom_tool_callback.py +104 -0
- libraos_sdk-1.0.1/libraos/_generated/models/custom_tool_callback_auth.py +71 -0
- libraos_sdk-1.0.1/libraos/_generated/models/custom_tool_callback_auth_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/custom_tool_callback_retry.py +78 -0
- libraos_sdk-1.0.1/libraos/_generated/models/custom_tool_callback_retry_backoff.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/custom_tool_result_request.py +80 -0
- libraos_sdk-1.0.1/libraos/_generated/models/deployment.py +137 -0
- libraos_sdk-1.0.1/libraos/_generated/models/deployment_auth.py +55 -0
- libraos_sdk-1.0.1/libraos/_generated/models/deployment_models.py +62 -0
- libraos_sdk-1.0.1/libraos/_generated/models/document.py +147 -0
- libraos_sdk-1.0.1/libraos/_generated/models/document_list.py +95 -0
- libraos_sdk-1.0.1/libraos/_generated/models/document_metadata.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/employee.py +198 -0
- libraos_sdk-1.0.1/libraos/_generated/models/employee_list.py +95 -0
- libraos_sdk-1.0.1/libraos/_generated/models/employee_update.py +133 -0
- libraos_sdk-1.0.1/libraos/_generated/models/error.py +126 -0
- libraos_sdk-1.0.1/libraos/_generated/models/error_type.py +17 -0
- libraos_sdk-1.0.1/libraos/_generated/models/file_meta.py +99 -0
- libraos_sdk-1.0.1/libraos/_generated/models/file_meta_list.py +86 -0
- libraos_sdk-1.0.1/libraos/_generated/models/get_agent_schema_response_200.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/hook_event.py +16 -0
- libraos_sdk-1.0.1/libraos/_generated/models/hook_subscription.py +117 -0
- libraos_sdk-1.0.1/libraos/_generated/models/hook_subscription_create.py +100 -0
- libraos_sdk-1.0.1/libraos/_generated/models/hook_subscription_list.py +75 -0
- libraos_sdk-1.0.1/libraos/_generated/models/import_employee_bundle_on_conflict.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/ingest_knowledge_response_201.py +69 -0
- libraos_sdk-1.0.1/libraos/_generated/models/ingest_knowledge_response_201_status.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/job.py +189 -0
- libraos_sdk-1.0.1/libraos/_generated/models/job_create.py +135 -0
- libraos_sdk-1.0.1/libraos/_generated/models/job_create_metadata.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/job_list.py +95 -0
- libraos_sdk-1.0.1/libraos/_generated/models/job_status.py +12 -0
- libraos_sdk-1.0.1/libraos/_generated/models/json_schema_object.py +51 -0
- libraos_sdk-1.0.1/libraos/_generated/models/knowledge_chunk.py +112 -0
- libraos_sdk-1.0.1/libraos/_generated/models/knowledge_chunk_metadata.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/knowledge_collection_list.py +61 -0
- libraos_sdk-1.0.1/libraos/_generated/models/knowledge_ingest_request.py +103 -0
- libraos_sdk-1.0.1/libraos/_generated/models/knowledge_ingest_request_metadata.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/knowledge_search_request.py +90 -0
- libraos_sdk-1.0.1/libraos/_generated/models/knowledge_search_response.py +75 -0
- libraos_sdk-1.0.1/libraos/_generated/models/list_files_recursive.py +9 -0
- libraos_sdk-1.0.1/libraos/_generated/models/list_settings_response_200.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/manifest.py +88 -0
- libraos_sdk-1.0.1/libraos/_generated/models/message.py +139 -0
- libraos_sdk-1.0.1/libraos/_generated/models/message_request.py +163 -0
- libraos_sdk-1.0.1/libraos/_generated/models/message_request_metadata.py +90 -0
- libraos_sdk-1.0.1/libraos/_generated/models/message_response.py +282 -0
- libraos_sdk-1.0.1/libraos/_generated/models/message_response_stop_reason.py +11 -0
- libraos_sdk-1.0.1/libraos/_generated/models/message_response_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/message_response_usage.py +70 -0
- libraos_sdk-1.0.1/libraos/_generated/models/model_config.py +109 -0
- libraos_sdk-1.0.1/libraos/_generated/models/model_slot.py +75 -0
- libraos_sdk-1.0.1/libraos/_generated/models/output_type_contract.py +96 -0
- libraos_sdk-1.0.1/libraos/_generated/models/output_type_contract_violation_mode.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/output_violation.py +80 -0
- libraos_sdk-1.0.1/libraos/_generated/models/persona_manifest_entry.py +118 -0
- libraos_sdk-1.0.1/libraos/_generated/models/persona_manifest_entry_emits_route_hint_kinds_item.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/persona_not_found_error.py +71 -0
- libraos_sdk-1.0.1/libraos/_generated/models/persona_triage.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/put_setting_body.py +61 -0
- libraos_sdk-1.0.1/libraos/_generated/models/role.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/route_hint_ask_clarification.py +74 -0
- libraos_sdk-1.0.1/libraos/_generated/models/route_hint_ask_clarification_kind.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/route_hint_navigate_to.py +97 -0
- libraos_sdk-1.0.1/libraos/_generated/models/route_hint_navigate_to_kind.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/route_hint_navigate_to_params.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/route_hint_render_inline.py +65 -0
- libraos_sdk-1.0.1/libraos/_generated/models/route_hint_render_inline_kind.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/session.py +107 -0
- libraos_sdk-1.0.1/libraos/_generated/models/session_create.py +81 -0
- libraos_sdk-1.0.1/libraos/_generated/models/setting_value.py +70 -0
- libraos_sdk-1.0.1/libraos/_generated/models/skill.py +72 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_custom_tool_use.py +93 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_custom_tool_use_input.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_custom_tool_use_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_done.py +82 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_done_status.py +10 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_done_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_error.py +77 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_error_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_route_hint.py +118 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_route_hint_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_text_delta.py +71 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_text_delta_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_thinking.py +71 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_thinking_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_tool_result.py +90 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_tool_result_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_tool_use.py +93 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_tool_use_input.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/stream_event_tool_use_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/text_block.py +71 -0
- libraos_sdk-1.0.1/libraos/_generated/models/text_block_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/tool_definition.py +105 -0
- libraos_sdk-1.0.1/libraos/_generated/models/tool_definition_type.py +11 -0
- libraos_sdk-1.0.1/libraos/_generated/models/tool_result_block.py +119 -0
- libraos_sdk-1.0.1/libraos/_generated/models/tool_result_block_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/tool_use_block.py +93 -0
- libraos_sdk-1.0.1/libraos/_generated/models/tool_use_block_input.py +47 -0
- libraos_sdk-1.0.1/libraos/_generated/models/tool_use_block_type.py +8 -0
- libraos_sdk-1.0.1/libraos/_generated/models/upload_document_body.py +87 -0
- libraos_sdk-1.0.1/libraos/_generated/models/user.py +116 -0
- libraos_sdk-1.0.1/libraos/_generated/models/user_create.py +89 -0
- libraos_sdk-1.0.1/libraos/_generated/models/user_create_role.py +11 -0
- libraos_sdk-1.0.1/libraos/_generated/models/user_list.py +75 -0
- libraos_sdk-1.0.1/libraos/_generated/models/user_role.py +11 -0
- libraos_sdk-1.0.1/libraos/_generated/models/web_search_backend.py +13 -0
- libraos_sdk-1.0.1/libraos/_generated/models/web_search_config.py +121 -0
- libraos_sdk-1.0.1/libraos/_generated/py.typed +1 -0
- libraos_sdk-1.0.1/libraos/_generated/types.py +54 -0
- libraos_sdk-1.0.1/libraos/_retry.py +73 -0
- libraos_sdk-1.0.1/libraos/_sse.py +57 -0
- libraos_sdk-1.0.1/libraos/_sync.py +79 -0
- libraos_sdk-1.0.1/libraos/_version.py +2 -0
- libraos_sdk-1.0.1/libraos/anthropic_compat.py +77 -0
- libraos_sdk-1.0.1/libraos/callbacks.py +177 -0
- libraos_sdk-1.0.1/libraos/client.py +282 -0
- libraos_sdk-1.0.1/libraos/errors.py +249 -0
- libraos_sdk-1.0.1/libraos/integrations/__init__.py +2 -0
- libraos_sdk-1.0.1/libraos/integrations/aws_lambda.py +45 -0
- libraos_sdk-1.0.1/libraos/integrations/fastapi.py +48 -0
- libraos_sdk-1.0.1/libraos/integrations/flask.py +37 -0
- libraos_sdk-1.0.1/libraos/resources/__init__.py +1 -0
- libraos_sdk-1.0.1/libraos/resources/_base.py +15 -0
- libraos_sdk-1.0.1/libraos/resources/agents.py +103 -0
- libraos_sdk-1.0.1/libraos/resources/documents.py +82 -0
- libraos_sdk-1.0.1/libraos/resources/employees.py +68 -0
- libraos_sdk-1.0.1/libraos/resources/filesystem.py +104 -0
- libraos_sdk-1.0.1/libraos/resources/hooks.py +74 -0
- libraos_sdk-1.0.1/libraos/resources/jobs.py +71 -0
- libraos_sdk-1.0.1/libraos/resources/knowledge.py +65 -0
- libraos_sdk-1.0.1/libraos/resources/messages.py +107 -0
- libraos_sdk-1.0.1/libraos/resources/personas.py +56 -0
- libraos_sdk-1.0.1/libraos/resources/sessions.py +39 -0
- libraos_sdk-1.0.1/libraos/resources/settings.py +38 -0
- libraos_sdk-1.0.1/libraos/resources/users.py +45 -0
- libraos_sdk-1.0.1/libraos/simulator/__init__.py +70 -0
- libraos_sdk-1.0.1/libraos/simulator/_loop.py +606 -0
- libraos_sdk-1.0.1/libraos/simulator/_signals.py +83 -0
- libraos_sdk-1.0.1/libraos/simulator/_wiring.py +133 -0
- libraos_sdk-1.0.1/libraos/simulator/archetype.py +260 -0
- libraos_sdk-1.0.1/libraos/simulator/archetype.schema.json +76 -0
- libraos_sdk-1.0.1/libraos/simulator/errors.py +83 -0
- libraos_sdk-1.0.1/libraos/simulator/prompt.py +235 -0
- libraos_sdk-1.0.1/libraos/simulator/simulate.py +467 -0
- libraos_sdk-1.0.1/libraos/simulator/types.py +152 -0
- libraos_sdk-1.0.1/libraos/streaming.py +130 -0
- libraos_sdk-1.0.1/libraos_sdk.egg-info/PKG-INFO +246 -0
- libraos_sdk-1.0.1/libraos_sdk.egg-info/SOURCES.txt +261 -0
- libraos_sdk-1.0.1/libraos_sdk.egg-info/dependency_links.txt +1 -0
- libraos_sdk-1.0.1/libraos_sdk.egg-info/requires.txt +13 -0
- libraos_sdk-1.0.1/libraos_sdk.egg-info/top_level.txt +1 -0
- libraos_sdk-1.0.1/pyproject.toml +43 -0
- libraos_sdk-1.0.1/setup.cfg +4 -0
- libraos_sdk-1.0.1/tests/test_agents_resource.py +91 -0
- libraos_sdk-1.0.1/tests/test_anthropic_compat.py +69 -0
- libraos_sdk-1.0.1/tests/test_anthropic_sdk_roundtrip.py +188 -0
- libraos_sdk-1.0.1/tests/test_aws_lambda_integration.py +84 -0
- libraos_sdk-1.0.1/tests/test_client.py +90 -0
- libraos_sdk-1.0.1/tests/test_employees_resource.py +83 -0
- libraos_sdk-1.0.1/tests/test_errors.py +64 -0
- libraos_sdk-1.0.1/tests/test_fastapi_integration.py +74 -0
- libraos_sdk-1.0.1/tests/test_flask_integration.py +72 -0
- libraos_sdk-1.0.1/tests/test_idempotency.py +78 -0
- libraos_sdk-1.0.1/tests/test_jobs_resource.py +79 -0
- libraos_sdk-1.0.1/tests/test_messages_resource.py +64 -0
- libraos_sdk-1.0.1/tests/test_new_resources.py +380 -0
- libraos_sdk-1.0.1/tests/test_retry.py +87 -0
- libraos_sdk-1.0.1/tests/test_simulator_archetype.py +209 -0
- libraos_sdk-1.0.1/tests/test_simulator_examples.py +65 -0
- libraos_sdk-1.0.1/tests/test_simulator_prompt.py +271 -0
- libraos_sdk-1.0.1/tests/test_simulator_run_eval.py +85 -0
- libraos_sdk-1.0.1/tests/test_simulator_simulate.py +581 -0
- libraos_sdk-1.0.1/tests/test_simulator_stream.py +586 -0
- libraos_sdk-1.0.1/tests/test_smoke.py +67 -0
- libraos_sdk-1.0.1/tests/test_sse.py +73 -0
- libraos_sdk-1.0.1/tests/test_streaming.py +83 -0
- libraos_sdk-1.0.1/tests/test_sync_proxy.py +71 -0
- libraos_sdk-1.0.1/tests/test_webhook_router.py +119 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: libraos-sdk
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Partner SDK for LibraOS — Anthropic Managed Agents compatible with multi-model + employee enhancements
|
|
5
|
+
Author-email: LibraOS Team <engineering@meganova.ai>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: httpx>=0.27
|
|
10
|
+
Requires-Dist: attrs>=23.1
|
|
11
|
+
Requires-Dist: anyio>=4.0
|
|
12
|
+
Requires-Dist: pydantic>=2.0
|
|
13
|
+
Requires-Dist: pyyaml>=6.0
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
17
|
+
Requires-Dist: openapi-python-client==0.28.3; extra == "dev"
|
|
18
|
+
Requires-Dist: anthropic>=0.30; extra == "dev"
|
|
19
|
+
Requires-Dist: fastapi>=0.110; extra == "dev"
|
|
20
|
+
Requires-Dist: flask>=3.0; extra == "dev"
|
|
21
|
+
|
|
22
|
+
# libraos-sdk
|
|
23
|
+
|
|
24
|
+
Python reference SDK for **LibraOS** — the agentic operating system that lets you build vertical AI products on a multi-model, multi-tenant runtime.
|
|
25
|
+
|
|
26
|
+
Published to PyPI as `libraos-sdk`. Status: **v0.9.0-rc1** — public API frozen for `v1.0.0`.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install libraos-sdk
|
|
32
|
+
# Optional — for Anthropic SDK drop-in compatibility
|
|
33
|
+
pip install anthropic
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from nova_os import Client, AnthropicCompatClient, WebhookRouter
|
|
40
|
+
|
|
41
|
+
# LibraOS extended client (multi-model, employees, bundles, async jobs, ...)
|
|
42
|
+
async with Client(base_url="https://nova.partner.com", api_key="...") as c:
|
|
43
|
+
agents = [a async for a in c.agents.list()]
|
|
44
|
+
msg = await c.messages.create(
|
|
45
|
+
agent_id="...",
|
|
46
|
+
messages=[{"role": "user", "content": "hi"}],
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Drop-in Anthropic SDK compat — partners using the Anthropic SDK
|
|
50
|
+
# can switch base_url and ship without any other code changes.
|
|
51
|
+
client = AnthropicCompatClient(base_url="https://nova.partner.com", api_key="...")
|
|
52
|
+
msg = client.messages.create(
|
|
53
|
+
model="gemini/gemini-3.1-pro-preview",
|
|
54
|
+
messages=[{"role": "user", "content": "hello"}],
|
|
55
|
+
max_tokens=256,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Mode B custom-tool webhook router (FastAPI mount shown; Flask/Lambda also supported)
|
|
59
|
+
router = WebhookRouter(secret="...")
|
|
60
|
+
@router.tool("fetch_invoice")
|
|
61
|
+
async def fetch_invoice(input, ctx): ...
|
|
62
|
+
app.include_router(router.fastapi_router(), prefix="/nova/cb")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
See `python/examples/` for 21 worked examples covering every public surface.
|
|
66
|
+
|
|
67
|
+
## Model names — vendor prefix required for the gateway
|
|
68
|
+
|
|
69
|
+
When LibraOS routes through the MegaNova gateway (the default for cloud + most self-hosted deployments), every model name MUST carry a `<vendor>/` prefix:
|
|
70
|
+
|
|
71
|
+
| Right | Wrong (returns `model_not_found`) |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `gemini/gemini-3.1-pro-preview` | `gemini-3.1-pro-preview` |
|
|
74
|
+
| `anthropic/claude-sonnet-4-6` | `claude-sonnet-4-6` |
|
|
75
|
+
| `anthropic/claude-haiku-4-5-20251001` | `claude-haiku-4-5-20251001` |
|
|
76
|
+
| `openai/gpt-5` | `gpt-5` |
|
|
77
|
+
|
|
78
|
+
This applies to:
|
|
79
|
+
- The `model=` arg on `c.messages.create(...)` and `c.jobs.create(...)`
|
|
80
|
+
- `model_config.{answer,planner,skill}.primary` in agent + employee YAML
|
|
81
|
+
- The `model:` field in agent markdown frontmatter
|
|
82
|
+
|
|
83
|
+
**For partners using the Anthropic SDK directly:** the SDK's natural default (`claude-opus-4-7` without prefix) won't resolve through the gateway. Either pin to a gateway-safe prefixed model in your config (for example, `ANTHROPIC_HIGH_MODEL=gemini/gemini-3.1-pro-preview`) or add a translation layer that prefixes bare Anthropic model names with `anthropic/` when routing through LibraOS.
|
|
84
|
+
|
|
85
|
+
The `agent_inference_model` and `ollama_embed_model` settings are exempt — they route to a local Ollama and use `<tag>:<version>` shape (e.g. `gemma4:e4b`).
|
|
86
|
+
|
|
87
|
+
To list all registered models (catalog discovery):
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
# Direct gateway query, requires a gateway-scoped key
|
|
91
|
+
import httpx
|
|
92
|
+
r = httpx.get("https://nova.partner.com/v1/models", headers={"Authorization": f"Bearer {api_key}"})
|
|
93
|
+
print([m["id"] for m in r.json()["data"]])
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Server-side tool observability — known v1.0.0 limitation
|
|
97
|
+
|
|
98
|
+
Anthropic-provided server-side tools (`web_search_20250305`, `code_execution_20250522`, etc.) execute on Anthropic's infrastructure and DO NOT emit discrete `content_block_start` / `content_block_stop` events on the SSE stream. Audit hooks that fire on `content_block_stop` for `tool_use` blocks won't see these invocations.
|
|
99
|
+
|
|
100
|
+
**Visible:** the model's text response references the search; `MessageResponse.content[]` (non-streaming) contains `server_tool_use` blocks.
|
|
101
|
+
**Not visible:** discrete tool-invocation events on the streaming path. Affects observability hooks that watch the SSE stream for `tool_use` events.
|
|
102
|
+
|
|
103
|
+
This is a pre-existing constraint of the underlying Anthropic API; LibraOS forwards what it receives. Partner-defined custom tools (Mode B via `WebhookRouter`) emit `custom_tool_use` events normally.
|
|
104
|
+
|
|
105
|
+
**Workaround for partners on v1.0.0:** inspect `MessageResponse.content` after the stream completes for `server_tool_use` blocks; OR use the non-streaming `messages.create` path when discrete tool observability matters.
|
|
106
|
+
|
|
107
|
+
Tracking [`libraos/sdk#10`](https://github.com/libraos/sdk/issues/10) for v1.1 — adds gateway-side synthetic event emission so audit hooks Just Work for server-side tools.
|
|
108
|
+
|
|
109
|
+
## Error handling
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from nova_os import (
|
|
113
|
+
NovaOSError,
|
|
114
|
+
NotFoundError,
|
|
115
|
+
RateLimitedError,
|
|
116
|
+
BillingError,
|
|
117
|
+
VertexSchemaError,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
try:
|
|
121
|
+
agent = await c.agents.get("does-not-exist")
|
|
122
|
+
except NotFoundError:
|
|
123
|
+
print("agent not found")
|
|
124
|
+
except RateLimitedError as e:
|
|
125
|
+
print(f"rate limited — retry after {e.retry_after}s")
|
|
126
|
+
except BillingError as e:
|
|
127
|
+
print(f"billing issue: {e.code}")
|
|
128
|
+
except VertexSchemaError as e:
|
|
129
|
+
# Deterministic schema bug — do NOT retry, fix the tool schema
|
|
130
|
+
print(f"Vertex schema error on tool={e.tool_name} param={e.parameter_path}")
|
|
131
|
+
print(f"Hint: {e.fix_hint}")
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Idempotency
|
|
135
|
+
|
|
136
|
+
Pass `idempotency_key=` to any `create()` call to safely retry on network failure:
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
agent = await c.agents.create(
|
|
140
|
+
id="marketing-assistant",
|
|
141
|
+
type="skill",
|
|
142
|
+
idempotency_key="create-marketing-agent-v1",
|
|
143
|
+
)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Resources
|
|
147
|
+
|
|
148
|
+
| Resource | Endpoints |
|
|
149
|
+
|----------|-----------|
|
|
150
|
+
| `c.agents` | `create`, `get`, `update`, `delete`, `list` |
|
|
151
|
+
| `c.employees` | `create`, `get`, `update`, `delete`, `list` |
|
|
152
|
+
| `c.messages` | `create`, `stream` |
|
|
153
|
+
| `c.jobs` | `create`, `get`, `cancel`, `list` |
|
|
154
|
+
|
|
155
|
+
## Sync mirror
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
# For scripts and notebooks — not inside async handlers
|
|
159
|
+
sync_agents = c.sync.agents.list() # returns a plain list
|
|
160
|
+
agent = c.sync.agents.create(id="foo", type="skill")
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Streaming
|
|
164
|
+
|
|
165
|
+
`c.messages.stream()` opens an SSE connection and returns an async context manager:
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
async with c.messages.stream(
|
|
169
|
+
agent_id="invoice-bot",
|
|
170
|
+
messages=[{"role": "user", "content": "Process invoice INV-9912"}],
|
|
171
|
+
) as stream:
|
|
172
|
+
async for event in stream:
|
|
173
|
+
if event["event"] == "text":
|
|
174
|
+
print(event["data"]["content"], end="", flush=True)
|
|
175
|
+
elif event["event"] == "done":
|
|
176
|
+
print() # newline at end
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Mode A — custom-tool inline** (intercept the LLM tool call, compute result, resume):
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
async with c.messages.stream(
|
|
183
|
+
agent_id="invoice-bot",
|
|
184
|
+
messages=[{"role": "user", "content": "Fetch invoice INV-9912"}],
|
|
185
|
+
message_id="my-request-id", # required for submit_tool_result before done
|
|
186
|
+
) as stream:
|
|
187
|
+
async for event in stream:
|
|
188
|
+
if event["event"] == "custom_tool_use":
|
|
189
|
+
result = await my_invoice_lookup(event["data"]["input"]["invoice_id"])
|
|
190
|
+
await stream.submit_tool_result(event["data"]["id"], result)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Webhook router (Mode B)
|
|
194
|
+
|
|
195
|
+
`WebhookRouter` receives LibraOS custom-tool dispatches on your HTTP endpoint, verifies the HMAC-SHA256 signature, dedupes by idempotency key, and dispatches to registered handlers:
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
from nova_os import WebhookRouter
|
|
199
|
+
|
|
200
|
+
router = WebhookRouter(secret="your-webhook-secret")
|
|
201
|
+
|
|
202
|
+
@router.tool("fetch_invoice")
|
|
203
|
+
async def fetch_invoice(input: dict, ctx: dict) -> str:
|
|
204
|
+
invoice = await db.get_invoice(input["invoice_id"])
|
|
205
|
+
return f"Invoice {invoice.id}: ${invoice.amount}"
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**FastAPI mount:**
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
from fastapi import FastAPI
|
|
212
|
+
|
|
213
|
+
app = FastAPI()
|
|
214
|
+
app.include_router(router.fastapi_router(), prefix="/nova/callbacks")
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Flask mount:**
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
from flask import Flask
|
|
221
|
+
|
|
222
|
+
app = Flask(__name__)
|
|
223
|
+
app.register_blueprint(router.flask_blueprint(), url_prefix="/nova/callbacks")
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**AWS Lambda mount:**
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
handler = router.aws_lambda_handler() # pass to Lambda runtime
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Changelog
|
|
233
|
+
|
|
234
|
+
See [CHANGELOG.md](CHANGELOG.md).
|
|
235
|
+
|
|
236
|
+
## Development
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
cd python
|
|
240
|
+
pip install -e ".[dev]"
|
|
241
|
+
pytest tests/ -v
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
MIT.
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# libraos-sdk
|
|
2
|
+
|
|
3
|
+
Python reference SDK for **LibraOS** — the agentic operating system that lets you build vertical AI products on a multi-model, multi-tenant runtime.
|
|
4
|
+
|
|
5
|
+
Published to PyPI as `libraos-sdk`. Status: **v0.9.0-rc1** — public API frozen for `v1.0.0`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install libraos-sdk
|
|
11
|
+
# Optional — for Anthropic SDK drop-in compatibility
|
|
12
|
+
pip install anthropic
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from nova_os import Client, AnthropicCompatClient, WebhookRouter
|
|
19
|
+
|
|
20
|
+
# LibraOS extended client (multi-model, employees, bundles, async jobs, ...)
|
|
21
|
+
async with Client(base_url="https://nova.partner.com", api_key="...") as c:
|
|
22
|
+
agents = [a async for a in c.agents.list()]
|
|
23
|
+
msg = await c.messages.create(
|
|
24
|
+
agent_id="...",
|
|
25
|
+
messages=[{"role": "user", "content": "hi"}],
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Drop-in Anthropic SDK compat — partners using the Anthropic SDK
|
|
29
|
+
# can switch base_url and ship without any other code changes.
|
|
30
|
+
client = AnthropicCompatClient(base_url="https://nova.partner.com", api_key="...")
|
|
31
|
+
msg = client.messages.create(
|
|
32
|
+
model="gemini/gemini-3.1-pro-preview",
|
|
33
|
+
messages=[{"role": "user", "content": "hello"}],
|
|
34
|
+
max_tokens=256,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# Mode B custom-tool webhook router (FastAPI mount shown; Flask/Lambda also supported)
|
|
38
|
+
router = WebhookRouter(secret="...")
|
|
39
|
+
@router.tool("fetch_invoice")
|
|
40
|
+
async def fetch_invoice(input, ctx): ...
|
|
41
|
+
app.include_router(router.fastapi_router(), prefix="/nova/cb")
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
See `python/examples/` for 21 worked examples covering every public surface.
|
|
45
|
+
|
|
46
|
+
## Model names — vendor prefix required for the gateway
|
|
47
|
+
|
|
48
|
+
When LibraOS routes through the MegaNova gateway (the default for cloud + most self-hosted deployments), every model name MUST carry a `<vendor>/` prefix:
|
|
49
|
+
|
|
50
|
+
| Right | Wrong (returns `model_not_found`) |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `gemini/gemini-3.1-pro-preview` | `gemini-3.1-pro-preview` |
|
|
53
|
+
| `anthropic/claude-sonnet-4-6` | `claude-sonnet-4-6` |
|
|
54
|
+
| `anthropic/claude-haiku-4-5-20251001` | `claude-haiku-4-5-20251001` |
|
|
55
|
+
| `openai/gpt-5` | `gpt-5` |
|
|
56
|
+
|
|
57
|
+
This applies to:
|
|
58
|
+
- The `model=` arg on `c.messages.create(...)` and `c.jobs.create(...)`
|
|
59
|
+
- `model_config.{answer,planner,skill}.primary` in agent + employee YAML
|
|
60
|
+
- The `model:` field in agent markdown frontmatter
|
|
61
|
+
|
|
62
|
+
**For partners using the Anthropic SDK directly:** the SDK's natural default (`claude-opus-4-7` without prefix) won't resolve through the gateway. Either pin to a gateway-safe prefixed model in your config (for example, `ANTHROPIC_HIGH_MODEL=gemini/gemini-3.1-pro-preview`) or add a translation layer that prefixes bare Anthropic model names with `anthropic/` when routing through LibraOS.
|
|
63
|
+
|
|
64
|
+
The `agent_inference_model` and `ollama_embed_model` settings are exempt — they route to a local Ollama and use `<tag>:<version>` shape (e.g. `gemma4:e4b`).
|
|
65
|
+
|
|
66
|
+
To list all registered models (catalog discovery):
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
# Direct gateway query, requires a gateway-scoped key
|
|
70
|
+
import httpx
|
|
71
|
+
r = httpx.get("https://nova.partner.com/v1/models", headers={"Authorization": f"Bearer {api_key}"})
|
|
72
|
+
print([m["id"] for m in r.json()["data"]])
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Server-side tool observability — known v1.0.0 limitation
|
|
76
|
+
|
|
77
|
+
Anthropic-provided server-side tools (`web_search_20250305`, `code_execution_20250522`, etc.) execute on Anthropic's infrastructure and DO NOT emit discrete `content_block_start` / `content_block_stop` events on the SSE stream. Audit hooks that fire on `content_block_stop` for `tool_use` blocks won't see these invocations.
|
|
78
|
+
|
|
79
|
+
**Visible:** the model's text response references the search; `MessageResponse.content[]` (non-streaming) contains `server_tool_use` blocks.
|
|
80
|
+
**Not visible:** discrete tool-invocation events on the streaming path. Affects observability hooks that watch the SSE stream for `tool_use` events.
|
|
81
|
+
|
|
82
|
+
This is a pre-existing constraint of the underlying Anthropic API; LibraOS forwards what it receives. Partner-defined custom tools (Mode B via `WebhookRouter`) emit `custom_tool_use` events normally.
|
|
83
|
+
|
|
84
|
+
**Workaround for partners on v1.0.0:** inspect `MessageResponse.content` after the stream completes for `server_tool_use` blocks; OR use the non-streaming `messages.create` path when discrete tool observability matters.
|
|
85
|
+
|
|
86
|
+
Tracking [`libraos/sdk#10`](https://github.com/libraos/sdk/issues/10) for v1.1 — adds gateway-side synthetic event emission so audit hooks Just Work for server-side tools.
|
|
87
|
+
|
|
88
|
+
## Error handling
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from nova_os import (
|
|
92
|
+
NovaOSError,
|
|
93
|
+
NotFoundError,
|
|
94
|
+
RateLimitedError,
|
|
95
|
+
BillingError,
|
|
96
|
+
VertexSchemaError,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
try:
|
|
100
|
+
agent = await c.agents.get("does-not-exist")
|
|
101
|
+
except NotFoundError:
|
|
102
|
+
print("agent not found")
|
|
103
|
+
except RateLimitedError as e:
|
|
104
|
+
print(f"rate limited — retry after {e.retry_after}s")
|
|
105
|
+
except BillingError as e:
|
|
106
|
+
print(f"billing issue: {e.code}")
|
|
107
|
+
except VertexSchemaError as e:
|
|
108
|
+
# Deterministic schema bug — do NOT retry, fix the tool schema
|
|
109
|
+
print(f"Vertex schema error on tool={e.tool_name} param={e.parameter_path}")
|
|
110
|
+
print(f"Hint: {e.fix_hint}")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Idempotency
|
|
114
|
+
|
|
115
|
+
Pass `idempotency_key=` to any `create()` call to safely retry on network failure:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
agent = await c.agents.create(
|
|
119
|
+
id="marketing-assistant",
|
|
120
|
+
type="skill",
|
|
121
|
+
idempotency_key="create-marketing-agent-v1",
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Resources
|
|
126
|
+
|
|
127
|
+
| Resource | Endpoints |
|
|
128
|
+
|----------|-----------|
|
|
129
|
+
| `c.agents` | `create`, `get`, `update`, `delete`, `list` |
|
|
130
|
+
| `c.employees` | `create`, `get`, `update`, `delete`, `list` |
|
|
131
|
+
| `c.messages` | `create`, `stream` |
|
|
132
|
+
| `c.jobs` | `create`, `get`, `cancel`, `list` |
|
|
133
|
+
|
|
134
|
+
## Sync mirror
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
# For scripts and notebooks — not inside async handlers
|
|
138
|
+
sync_agents = c.sync.agents.list() # returns a plain list
|
|
139
|
+
agent = c.sync.agents.create(id="foo", type="skill")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Streaming
|
|
143
|
+
|
|
144
|
+
`c.messages.stream()` opens an SSE connection and returns an async context manager:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
async with c.messages.stream(
|
|
148
|
+
agent_id="invoice-bot",
|
|
149
|
+
messages=[{"role": "user", "content": "Process invoice INV-9912"}],
|
|
150
|
+
) as stream:
|
|
151
|
+
async for event in stream:
|
|
152
|
+
if event["event"] == "text":
|
|
153
|
+
print(event["data"]["content"], end="", flush=True)
|
|
154
|
+
elif event["event"] == "done":
|
|
155
|
+
print() # newline at end
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Mode A — custom-tool inline** (intercept the LLM tool call, compute result, resume):
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
async with c.messages.stream(
|
|
162
|
+
agent_id="invoice-bot",
|
|
163
|
+
messages=[{"role": "user", "content": "Fetch invoice INV-9912"}],
|
|
164
|
+
message_id="my-request-id", # required for submit_tool_result before done
|
|
165
|
+
) as stream:
|
|
166
|
+
async for event in stream:
|
|
167
|
+
if event["event"] == "custom_tool_use":
|
|
168
|
+
result = await my_invoice_lookup(event["data"]["input"]["invoice_id"])
|
|
169
|
+
await stream.submit_tool_result(event["data"]["id"], result)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Webhook router (Mode B)
|
|
173
|
+
|
|
174
|
+
`WebhookRouter` receives LibraOS custom-tool dispatches on your HTTP endpoint, verifies the HMAC-SHA256 signature, dedupes by idempotency key, and dispatches to registered handlers:
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
from nova_os import WebhookRouter
|
|
178
|
+
|
|
179
|
+
router = WebhookRouter(secret="your-webhook-secret")
|
|
180
|
+
|
|
181
|
+
@router.tool("fetch_invoice")
|
|
182
|
+
async def fetch_invoice(input: dict, ctx: dict) -> str:
|
|
183
|
+
invoice = await db.get_invoice(input["invoice_id"])
|
|
184
|
+
return f"Invoice {invoice.id}: ${invoice.amount}"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**FastAPI mount:**
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
from fastapi import FastAPI
|
|
191
|
+
|
|
192
|
+
app = FastAPI()
|
|
193
|
+
app.include_router(router.fastapi_router(), prefix="/nova/callbacks")
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Flask mount:**
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
from flask import Flask
|
|
200
|
+
|
|
201
|
+
app = Flask(__name__)
|
|
202
|
+
app.register_blueprint(router.flask_blueprint(), url_prefix="/nova/callbacks")
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**AWS Lambda mount:**
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
handler = router.aws_lambda_handler() # pass to Lambda runtime
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Changelog
|
|
212
|
+
|
|
213
|
+
See [CHANGELOG.md](CHANGELOG.md).
|
|
214
|
+
|
|
215
|
+
## Development
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
cd python
|
|
219
|
+
pip install -e ".[dev]"
|
|
220
|
+
pytest tests/ -v
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""LibraOS SDK — partner integration for LibraOS.
|
|
2
|
+
|
|
3
|
+
See https://github.com/libraos/sdk for documentation.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from libraos._version import __version__, OPENAPI_VERSION
|
|
7
|
+
from libraos.client import Client
|
|
8
|
+
from libraos.anthropic_compat import AnthropicCompatClient
|
|
9
|
+
from libraos.errors import (
|
|
10
|
+
NovaOSError,
|
|
11
|
+
AuthenticationError,
|
|
12
|
+
PermissionError,
|
|
13
|
+
NotFoundError,
|
|
14
|
+
RateLimitedError,
|
|
15
|
+
BillingError,
|
|
16
|
+
UpstreamError,
|
|
17
|
+
VertexSchemaError,
|
|
18
|
+
ModelNotFoundError,
|
|
19
|
+
InternalError,
|
|
20
|
+
PersonaNotFound,
|
|
21
|
+
)
|
|
22
|
+
from libraos.callbacks import WebhookRouter
|
|
23
|
+
from libraos.streaming import MessageStream
|
|
24
|
+
from libraos.simulator import (
|
|
25
|
+
Archetype,
|
|
26
|
+
ArchetypeValidationError,
|
|
27
|
+
SimulationResult,
|
|
28
|
+
Turn,
|
|
29
|
+
simulate,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"__version__",
|
|
34
|
+
"OPENAPI_VERSION",
|
|
35
|
+
"Client",
|
|
36
|
+
"AnthropicCompatClient",
|
|
37
|
+
"NovaOSError",
|
|
38
|
+
"AuthenticationError",
|
|
39
|
+
"PermissionError",
|
|
40
|
+
"NotFoundError",
|
|
41
|
+
"RateLimitedError",
|
|
42
|
+
"BillingError",
|
|
43
|
+
"UpstreamError",
|
|
44
|
+
"VertexSchemaError",
|
|
45
|
+
"ModelNotFoundError",
|
|
46
|
+
"InternalError",
|
|
47
|
+
"PersonaNotFound",
|
|
48
|
+
"WebhookRouter",
|
|
49
|
+
"MessageStream",
|
|
50
|
+
"Archetype",
|
|
51
|
+
"ArchetypeValidationError",
|
|
52
|
+
"SimulationResult",
|
|
53
|
+
"Turn",
|
|
54
|
+
"simulate",
|
|
55
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|